package ru.ncedu.java.vlku.hrs.uil.cmd;

import ru.ncedu.java.vlku.hrs.bll.HRSManager;
import ru.ncedu.java.vlku.hrs.bll.HRSManagerFactory;
import ru.ncedu.java.vlku.hrs.model.Cargo;

public class CreateCargo implements Command {
    // create cargo <name> <weight>
    @Override
    public void execute( String[] args ) {
        if (args.length != 4)
            throw new IllegalArgumentException();
        Double weight = Double.parseDouble(args[3]);
        Cargo cargo = new Cargo(args[2], weight);
        HRSManager manager = HRSManagerFactory.getInstance().getHRSManager();
        manager.createCargo(cargo);
    }
}
